﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace TrainningWeekend
{
    class Rectage
    {
        public Rectage(int length, int width):this()
        {
            Length = length;
            Width = width;
        }

        public Rectage()
        {
            Console.WriteLine("构造一个矩形");
        }

        public void Something()
        {

        }

        private int length;
        private int width;

        public int Length
        {
            set
            {
                if (value < 3)
                {
                    length = 3;
                }
                else if (value > 30)
                {
                    length = 30;
                }
                else
                {
                    length = value;
                }
            }
            get
            {
                return length;
            }
        }

        public int Width
        {
            set
            {
                if (value > 30)
                {
                    width = 30;
                }
                else if (value < 3)
                {
                    width = 3;
                }
                else
                {
                    width = value;
                }
            }
            get
            {
                return width;
            }
        }

        public int Area
        {
            get
            {
                return length * width;
            }
        }
    }

    class MyRectage : Rectage
    {
        public MyRectage() : base(3,3)
        {
        }
    }
}
